package com.wpml.cloud.myprovider.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class EventTestController {

    /**
     * @Description localhost:9001/event.html
     * 浏览器轮询拉取数据   （浏览器模拟长链接）
     * @Author Wang Pei
     * @Date 2021/5/13 21:55
     **/
    @RequestMapping(value = "event", produces = "text/event-stream;charset=utf-8")
    public Object event() {
        System.out.println("来了，老弟！");
        return "data:" + new Date().getTime() + "\n\n";
    }
}
